<style lang="scss" scoped>
.coupons {
  margin-top: 3.5rem;
  background-color: #fff;
  border-radius: 8px;
  padding: 1.5rem 1rem 1rem;
  box-sizing: border-box;
  position: relative;

  .title {
    width: 12rem;
    height: 3rem;
    background: var(--btn_color);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    line-height: 3rem;
    text-align: center;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    letter-spacing: 0.3rem;
    font-size: 1.4rem;
    span {
      display: inline-block;
      width: 1rem;
      height: 1rem;
      border-radius: 1rem;
      background-color: #ffdb89;
    }
    span:nth-child(1) {
      margin-right: 0.5rem;
    }
    span:nth-child(2) {
      margin-left: 0.2rem;
    }
    .triangle_left_border {
      width: 0;
      height: 0;
      border-bottom: 1.5rem solid var(--btn_color);
      border-left: 1.5rem solid transparent;
      position: absolute;
      left: 0%;
      top: 0%;
      margin-left: -1.5rem;
    }
    .triangle_right_border {
      width: 0;
      height: 0;
      border-bottom: 1.5rem solid var(--btn_color);
      border-right: 1.5rem solid transparent;
      position: absolute;
      left: 100%;
      top: 0%;
    }
  }

  // 佣金排行
  .commission {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2.5rem;
    .conter_group_one {
      display: flex;
      align-items: center;
      .max {
        display: flex;
        align-items: center;
        margin-left: 4rem;
        font-size: 1.6rem;
        span {
          // padding: 100px;
          display: inline-block;
          margin-left: 10px;
        }
      }
    }
    .conter_group_two {
      display: flex;
      flex-direction: column;
      text-align: right;
      font-size: 1.6rem;
      color: #999;
    }
  }

  .seamless-warp {
    height: 28rem;
    overflow: hidden;
  }
}
</style>
<template>
  <div
    class="coupons"
    v-if="comList.length > 0"
    :style="{ '--btn_color': btn_color }"
  >
    <div class="title">
      <span></span>
      <div>佣金排行</div>
      <span></span>
      <div class="triangle_left_border"></div>
      <div class="triangle_right_border"></div>
    </div>

    <vue-seamless-scroll
      :data="comList"
      :class-option="optionSetting"
      class="seamless-warp"
      v-if="commissionList.length > 4"
    >
      <div class="commission" v-for="(item, i) in comList" :key="i">
        <div class="conter_group_one">
          <div style="font-size: 1.6rem">
            {{ i + 1 }}
          </div>
          <div class="max">
            <div style="width: 40px; height: 40px">
              <img
                style="width: 40px; height: 40px; border-radius: 20px"
                :src="item.avatar"
              />
            </div>
            <span>{{ item.nickname }}</span>
          </div>
        </div>
        <div class="conter_group_two">
          <span style="color: #333333; margin-bottom: 0.8rem"
            >￥{{ item.price }}</span
          >
        </div>
      </div>
    </vue-seamless-scroll>
    
    <div v-else class="commission" v-for="(item, i) in comList" :key="i">
        <div class="conter_group_one">
          <div style="font-size: 1.6rem">
            {{ i + 1 }}
          </div>
          <div class="max">
            <div style="width: 40px; height: 40px">
              <img
                style="width: 40px; height: 40px; border-radius: 20px"
                :src="item.avatar"
              />
            </div>
            <span>{{ item.nickname }}</span>
          </div>
        </div>
        <div class="conter_group_two">
          <span style="color: #333333; margin-bottom: 0.8rem"
            >￥{{ item.price }}</span
          >
        </div>
      </div>

    <NodataPiz v-else></NodataPiz>
  </div>
</template> 
<script>
import { Tab, Tabs, List, Loading } from "vant";
import NodataPiz from "@/components/NodataPiz";
// import CaseList from "@/components/CaseList.vue";
export default {
  name: "ActiveContent",
  components: {
    [List.name]: List,
    [Tab.name]: Tab,
    [Tabs.name]: Tabs,
    [Loading.name]: Loading,
    NodataPiz,
  },
  props: {
    activityItem: {
      type: Object,
      required: true,
    },
    commissionList: {
      type: Array,
      required: true,
    },
  },
  watch: {
    commissionList: {
      handler(value) {
        this.comList = value;
      },
    },
  },
  data() {
    return {
      btn_color: "",
      comList: [],
    };
  },
  computed: {
    optionSetting() {
      return {
        step: 0.4, // 数值越大速度滚动越快
        limitMoveNum: 2, // 开始无缝滚动的数据量 this.dataList.length
        hoverStop: true, // 是否开启鼠标悬停stop
        direction: 1, // 0向下 1向上 2向左 3向右
        openWatch: true, // 开启数据实时监控刷新dom
        singleHeight: 0, // 单步运动停止的高度(默认值0是无缝不停止的滚动) direction => 0/1
        singleWidth: 0, // 单步运动停止的宽度(默认值0是无缝不停止的滚动) direction => 2/3
        waitTime: 1000, // 单步运动停止的时间(默认值1000ms)
      };
    },
  },
  created() {
    const _this = this;
    _this.btn_color = _this.activityItem.btn_color;
    console.log(_this.commissionList, "commissionList");
  },
  mounted() {},
  methods: {},
};
</script>
